package com.example.books.Controller;

import com.example.books.Pojo.NoticeDO;
import com.example.books.Service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
public class NoticeController {

    @Autowired
    private NoticeService noticeService;


    @GetMapping("/getNotice")
    public List<NoticeDO> getNotice(){
        System.out.println( noticeService.getNotices());
        return noticeService.getNotices();
    }

    @PostMapping("/setNotice")
    public boolean setNotice(@RequestBody Map<String,Object> map){
        return noticeService.setNotices(map);
    }

    @PostMapping("/UpdateNotice")
    public boolean updateNotice(@RequestBody Map<String,Object> map){
        System.out.println(map);
        return noticeService.updateNotices(map);
    }

    @PostMapping("/deleteNotice")
    public boolean deleteNotice(@RequestBody Map<String,Object> map){
        return noticeService.deleteNotices(map);
    }
}
